import pika, json

# params = pika.URLParameters('your_rabbitmq_url')
# connection = pika.BlockingConnection(params)
# channel = connection.channel()

credentials = pika.PlainCredentials("admin",'admin')
connection = pika.BlockingConnection(pika.ConnectionParameters('10.0.0.101',credentials=credentials))
channel = connection.channel()


def publish(method, body):
    properties = pika.BasicProperties(method)
    channel.basic_publish(exchange='', routing_key='admin', body=json.dumps(body), properties=properties)
